package com.uzai.console.web.orderpull;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.dto.orderpull.OrderPullIdDto;
import com.uzai.console.dto.orderpull.OrderPullIdListDto;
import com.uzai.console.dto.orderpull.OrderPullQuery;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.service.orderpull.OrderPullService;
import com.uzai.console.vo.orderpull.OrderPullVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 订单拉取
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "订单拉取",tags = "订单|订单拉取")
@ApiSort(31)
@RestController
public class OrderPullController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(OrderPullController.class);

    @Autowired
    private OrderPullService orderPullService;

    @ApiOperation(value = "分页查询订单拉取列表", notes = "分页查询订单拉取列表", response = OrderPullVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/orderPull/findByPage")
    public Object findOrderPullPage(@RequestBody OrderPullQuery orderPullQuery){
        return orderPullService.findOrderPullList(orderPullQuery);
    }

    @ApiOperation(value = "查询订单拉取任务详情", notes = "查询订单拉取任务详情", response = OrderPullVo.class)
    @ApiOperationSupport(order = 2)
    @PostMapping("/orderPull/findById")
    public Object findOrderPull(@RequestBody OrderPullIdDto orderPullIdDto){
        return orderPullService.findOrderPull(orderPullIdDto);
    }

    @SystemLogType(model = SystemModelEnum.OrderPull, type = OperationTypeEnum.DELETE)
    @ApiOperation(value = "批量删除清理订单拉取", notes = "批量删除清理订单拉取")
    @ApiOperationSupport(order = 3)
    @PostMapping("/orderPull/batchDelete")
    public Object batchDeleteOrderPull(@RequestBody OrderPullIdListDto orderPullIdListDto){
        orderPullService.batchDeleteOrderPull(orderPullIdListDto);
        return true;
    }

}
